Kanzi 3.9.10
kanzi::MessageArguments Class Reference

MessageArguments is the base class for arguments passed in messages. More...

#include <kanzi/core.ui/message/message_arguments.hpp>

Inheritance diagram for kanzi::MessageArguments:
[legend]

Classes

struct  ArgumentEntry
 Linked list entry containing arguments type and value. More...
 

Public Member Functions

bool getAbstractArgument (AbstractPropertyType argumentType, Variant &variant) const
 Returns the value of an argument using AbstractPropertyType.
 
template<typename TDataType >
TDataType getArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument.
 
detail::MessageDispatcher * getDispatcher () const
 Returns the message dispatcher that dispatches a message.
 
template<typename TDataType >
optional< TDataTypegetOptionalArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument.
 
shared_ptr< NodegetSource () const
 Returns the source node for a message.
 
TimePoint getTimestamp () const
 Returns the timestamp of a message.
 
AbstractMessageType getType () const
 Returns the message type of these message arguments as an AbstractMessageType instance.
 
bool isFrom (const Node &source) const
 Returns whether a node is the source node of a message.
 
bool isHandled () const
 Returns whether the message is handled.
 
bool isValid () const
 Returns whether a message is valid.
 
 MessageArguments ()=default
 Constructor.
 
 MessageArguments (const MessageArguments &)=delete
 Deleted copy.
 
MessageArgumentsoperator= (const MessageArguments &)=delete
 Deleted assignment.
 
void setAbstractArgument (AbstractPropertyType argumentType, const Variant &variant)
 Sets the value of an argument using AbstractPropertyType.
 
template<typename TDataType >
void setArgument (const PropertyType< TDataType > &argumentType, typename PropertyType< TDataType >::DataType value)
 Sets the value of an argument.
 
void setDispatcher (detail::MessageDispatcher *dispatcher)
 Sets a dispatcher for a message.
 
void setHandled (bool handled)
 Sets the handling status for a message.
 
void setSource (Node *source)
 Sets the source node that dispatches a message.
 
void setTimestamp (TimePoint timestamp)
 Sets the timestamp of a message.
 
void setType (AbstractMessageType type)
 Sets the type of a message.
 
void setValid (bool valid)
 Sets the validity of a message.
 
 ~MessageArguments ()
 Destructor.
 

Static Public Member Functions

static size_t getArgumentAllocatorPoolSize ()
 Gets the current size of memory pool of argument entries.
 
static const MetaclassgetStaticMetaclass ()
 Initializes and returns static metadata of base MessageArguments class.
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Initializes and returns the Kanzi Studio editor information.
 

Detailed Description

MessageArguments is the base class for arguments passed in messages.

An instance of MessageArguments together with an instance of MessageType forms a Kanzi message. In Kanzi when you dispatch a message, you dispatch a message of certain type and arguments.

While MessageArguments is a base class where you can inherit your own specialized arguments, MessageType is a templated class which takes message argument type as its template parameter. In practice this means that each MessageType is linked with a certain MessageArguments type. You can derive your own arguments class or use the MessageArguments base class. Note that MessageArguments as a base class carries only the basic message information, such as the timestamp and source of the message. To dispatch any other data with your messages, inherit your own message arguments class.

You can link a message type with only one type of message arguments, but you can use a certain type of message arguments with multiple message types. See MessageType.

See also
For examples on using Kanzi message arguments, message types and messages in general, see Node and MessageType.

Constructor & Destructor Documentation

◆ MessageArguments() [1/2]

kanzi::MessageArguments::MessageArguments ( )
explicitdefault

Constructor.

◆ ~MessageArguments()

kanzi::MessageArguments::~MessageArguments ( )

Destructor.

◆ MessageArguments() [2/2]

kanzi::MessageArguments::MessageArguments ( const MessageArguments & )
delete

Deleted copy.

Member Function Documentation

◆ operator=()

MessageArguments & kanzi::MessageArguments::operator= ( const MessageArguments & )
delete

Deleted assignment.

◆ getArgument()

template<typename TDataType >
TDataType kanzi::MessageArguments::getArgument ( const PropertyType< TDataType > & argumentType) const
inline

Returns the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to fetch.
Returns
The value of the argument. If the argument is not present in this message arguments instance, returns the default value of the PropertyType.

◆ getOptionalArgument()

template<typename TDataType >
optional< TDataType > kanzi::MessageArguments::getOptionalArgument ( const PropertyType< TDataType > & argumentType) const
inline

Returns the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to fetch.
Returns
The value of the argument. If the argument is not present in this message arguments instance, returns nullopt.

◆ getAbstractArgument()

bool kanzi::MessageArguments::getAbstractArgument ( AbstractPropertyType argumentType,
Variant & variant ) const

Returns the value of an argument using AbstractPropertyType.

Parameters
argumentTypeThe AbstractPropertyType argument whose value to get.
variantThe variant where to store the message argument value.
Returns
If the argumentType is present in this message arguments instance, true, otherwise false.

◆ setArgument()

template<typename TDataType >
void kanzi::MessageArguments::setArgument ( const PropertyType< TDataType > & argumentType,
typename PropertyType< TDataType >::DataType value )
inline

Sets the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to set.
valueThe value to set for the argument.

◆ setAbstractArgument()

void kanzi::MessageArguments::setAbstractArgument ( AbstractPropertyType argumentType,
const Variant & variant )

Sets the value of an argument using AbstractPropertyType.

Parameters
argumentTypeThe AbstractPropertyType argument whose value to set.
variantThe variant whose value to store to the message argument value.

◆ isFrom()

bool kanzi::MessageArguments::isFrom ( const Node & source) const
inline

Returns whether a node is the source node of a message.

Parameters
sourceThe node to check.
Returns
If the passed node is the source of the message, true, otherwise false.

◆ getSource()

shared_ptr< Node > kanzi::MessageArguments::getSource ( ) const

Returns the source node for a message.

Returns
The source node where the message was dispatched.

◆ setHandled()

void kanzi::MessageArguments::setHandled ( bool handled)
inline

Sets the handling status for a message.

Parameters
handledThe new handling status.

◆ isHandled()

bool kanzi::MessageArguments::isHandled ( ) const
inline

Returns whether the message is handled.

Returns
If the message is handled, true, otherwise false.

◆ getTimestamp()

TimePoint kanzi::MessageArguments::getTimestamp ( ) const
inline

Returns the timestamp of a message.

Returns
The timestamp of the message.

◆ getDispatcher()

detail::MessageDispatcher * kanzi::MessageArguments::getDispatcher ( ) const
inline

Returns the message dispatcher that dispatches a message.

Returns
The MessageDispatcher that dispatches the message.

◆ getType()

AbstractMessageType kanzi::MessageArguments::getType ( ) const
inline

Returns the message type of these message arguments as an AbstractMessageType instance.

Returns
The AbstractMessageType of these message arguments.

◆ setSource()

void kanzi::MessageArguments::setSource ( Node * source)
inline

Sets the source node that dispatches a message.

Parameters
sourceThe source of the message.

◆ setTimestamp()

void kanzi::MessageArguments::setTimestamp ( TimePoint timestamp)
inline

Sets the timestamp of a message.

Parameters
timestampThe timestamp of the message.

◆ setValid()

void kanzi::MessageArguments::setValid ( bool valid)
inline

Sets the validity of a message.

Parameters
validThe validity of the message.

◆ isValid()

bool kanzi::MessageArguments::isValid ( ) const
inline

Returns whether a message is valid.

Returns
If the message is valid, returns true, otherwise false.

◆ setDispatcher()

void kanzi::MessageArguments::setDispatcher ( detail::MessageDispatcher * dispatcher)
inline

Sets a dispatcher for a message.

Parameters
dispatcherMessage dispatcher that dispatches the message.

◆ setType()

void kanzi::MessageArguments::setType ( AbstractMessageType type)
inline

Sets the type of a message.

Parameters
typeThe type of the message.

◆ getArgumentAllocatorPoolSize()

static size_t kanzi::MessageArguments::getArgumentAllocatorPoolSize ( )
static

Gets the current size of memory pool of argument entries.

◆ getStaticMetaclass()

static const Metaclass * kanzi::MessageArguments::getStaticMetaclass ( )
static

Initializes and returns static metadata of base MessageArguments class.

Returns
Metaclass object holding metadata of base MessageArguments class.

◆ makeEditorInfo()

static PropertyTypeEditorInfoSharedPtr kanzi::MessageArguments::makeEditorInfo ( )
inlinestatic

Initializes and returns the Kanzi Studio editor information.

Returns
Editor information for Kanzi Studio.

The documentation for this class was generated from the following file: